package offer;

public class Solution22 {
    int index;

    public ListNode getKthFromEnd(ListNode head, int k) {
        if (head == null) {
            return null;
        }
        ListNode t = getKthFromEnd(head.next, k);
        index++;
        if (index == k) {
            return head;
        } else {
            return t;
        }
    }
}
